<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:a="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <h:form id="tarefa" styleClass="edit">

        <rich:panel>
            <f:facet name="header">#{tarefaHome.managed ? 'Edit' : 'Add'} Tarefa</f:facet>




            <s:decorate id="fimField" template="layout/edit.xhtml">
                <ui:define name="label">Fim</ui:define>
                <rich:calendar id="fim"
                       required="true"
                          value="#{tarefaHome.instance.fim}" datePattern="MM/dd/yyyy hh:mm a"/>
            </s:decorate>


            <s:decorate id="inicioField" template="layout/edit.xhtml">
                <ui:define name="label">Inicio</ui:define>
                <rich:calendar id="inicio"
                       required="true"
                          value="#{tarefaHome.instance.inicio}" datePattern="MM/dd/yyyy hh:mm a"/>
            </s:decorate>


            <s:decorate id="milestoneField" template="layout/edit.xhtml">
                <ui:define name="label">Milestone</ui:define>
                <h:selectBooleanCheckbox id="milestone"
                                      value="#{tarefaHome.instance.milestone}"/>
            </s:decorate>


            <s:decorate id="nomeField" template="layout/edit.xhtml">
                <ui:define name="label">Nome</ui:define>
                <h:inputTextarea id="nome"
                               cols="80"
                               rows="3"
                              value="#{tarefaHome.instance.nome}"/>
            </s:decorate>


            <s:decorate id="porcentcompField" template="layout/edit.xhtml">
                <ui:define name="label">Porcentcomp</ui:define>
                <h:inputText id="porcentcomp"
                          value="#{tarefaHome.instance.porcentcomp}">
                    <a:support event="onblur" reRender="porcentcompField" bypassUpdates="true" ajaxSingle="true"/>
                </h:inputText>
            </s:decorate>






            <div style="clear:both">
                <span class="required">*</span>
                required fields
            </div>

        </rich:panel>

        <div class="actionButtons">

            <h:commandButton id="save"
                          value="Save"
                         action="#{tarefaHome.persist}"
                       disabled="#{!tarefaHome.wired}"
                       rendered="#{!tarefaHome.managed}"/>

            <h:commandButton id="update"
                          value="Save"
                         action="#{tarefaHome.update}"
                       rendered="#{tarefaHome.managed}"/>

            <h:commandButton id="delete"
                          value="Delete"
                         action="#{tarefaHome.remove}"
                      immediate="true"
                       rendered="#{tarefaHome.managed}"/>

            <s:button id="cancelEdit"
                   value="Cancel"
             propagation="end"
                    view="/Tarefa.xhtml"
                rendered="#{tarefaHome.managed}"/>

            <s:button id="cancelAdd"
                   value="Cancel"
             propagation="end"
                    view="/#{empty tarefaFrom ? 'TarefaList' : tarefaFrom}.xhtml"
                rendered="#{!tarefaHome.managed}"/>

        </div>
    </h:form>

<rich:tabPanel switchType="ajax">

    <rich:tab label="Projeto *" labelClass="required">
    <div class="association" id="projetoParent">

        <h:outputText value="There is no projeto associated with this tarefa."
                   rendered="#{tarefaHome.instance.projeto == null}"/>

        <rich:dataTable var="_projeto"
                   value="#{tarefaHome.instance.projeto}"
                rendered="#{tarefaHome.instance.projeto != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="projetoTable">
            <h:column>
                <f:facet name="header">Id</f:facet>
                <h:outputText value="#{_projeto.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Statusprojeto id</f:facet>
                <h:outputText value="#{_projeto.statusprojeto.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Usuario id</f:facet>
                <h:outputText value="#{_projeto.usuario.id}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Cliente</f:facet>
                <h:outputText value="#{_projeto.cliente}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Custoprevisto</f:facet>
                <h:outputText value="#{_projeto.custoprevisto}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Datacriacao</f:facet>
                <h:outputText value="#{_projeto.datacriacao}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Fim</f:facet>
                <h:outputText value="#{_projeto.fim}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Fimprevisto</f:facet>
                <h:outputText value="#{_projeto.fimprevisto}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Inicio</f:facet>
                <h:outputText value="#{_projeto.inicio}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Justificativa</f:facet>
                <h:outputText value="#{_projeto.justificativa}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Necessidades</f:facet>
                <h:outputText value="#{_projeto.necessidades}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Nome</f:facet>
                <h:outputText value="#{_projeto.nome}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Orcamento</f:facet>
                <h:outputText value="#{_projeto.orcamento}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Premissas</f:facet>
                <h:outputText value="#{_projeto.premissas}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Produto</f:facet>
                <h:outputText value="#{_projeto.produto}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Responsabilidadesgp</f:facet>
                <h:outputText value="#{_projeto.responsabilidadesgp}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Restricoes</f:facet>
                <h:outputText value="#{_projeto.restricoes}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Resumo</f:facet>
                <h:outputText value="#{_projeto.resumo}"/>
            </h:column>
        </rich:dataTable>

        <div class="actionButtons">
            <s:button id="#{tarefaHome.instance.projeto != null ? 'changeParent' : 'selectParent'}" value="#{tarefaHome.instance.projeto != null ? 'Change' : 'Select'} projeto"
                       view="/ProjetoList.xhtml">
                <f:param name="from" value="TarefaEdit"/>
            </s:button>
        </div>

    </div>
    </rich:tab>

    <rich:tab label="Subtarefas for subtarefaid">
        <h:form styleClass="association" id="subtarefasForSubtarefaidChildren">

            <h:outputText value="There are no subtarefasForSubtarefaid associated with this tarefa."
                       rendered="#{empty tarefaHome.subtarefasForSubtarefaid}"/>

            <rich:dataTable value="#{tarefaHome.subtarefasForSubtarefaid}"
                           var="_subtarefa"
                      rendered="#{not empty tarefaHome.subtarefasForSubtarefaid}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="subtarefasForSubtarefaidTable">
                <rich:column sortBy="#{_subtarefa.id.subtarefaid}">
                    <f:facet name="header">Subtarefaid</f:facet>
                    <h:outputText value="#{_subtarefa.id.subtarefaid}"/>
                </rich:column>
                <rich:column sortBy="#{_subtarefa.id.tarefaid}">
                    <f:facet name="header">Tarefaid</f:facet>
                    <h:outputText value="#{_subtarefa.id.tarefaid}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{tarefaHome.managed}" id="subtarefasForSubtarefaid">
        <div class="actionButtons">
            <s:button id="addsubtarefa"
                   value="Add subtarefa"
                    view="/SubtarefaEdit.xhtml"
             propagation="none">
                 <f:param name="tarefaId"
                         value="#{tarefaHome.instance.id}"/>
                 <f:param name="subtarefaFrom" value="Tarefa"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Tarefapredecessoras for tarefaid">
        <h:form styleClass="association" id="tarefapredecessorasForTarefaidChildren">

            <h:outputText value="There are no tarefapredecessorasForTarefaid associated with this tarefa."
                       rendered="#{empty tarefaHome.tarefapredecessorasForTarefaid}"/>

            <rich:dataTable value="#{tarefaHome.tarefapredecessorasForTarefaid}"
                           var="_tarefapredecessora"
                      rendered="#{not empty tarefaHome.tarefapredecessorasForTarefaid}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="tarefapredecessorasForTarefaidTable">
                <rich:column sortBy="#{_tarefapredecessora.id.tarefapredecessoraid}">
                    <f:facet name="header">Tarefapredecessoraid</f:facet>
                    <h:outputText value="#{_tarefapredecessora.id.tarefapredecessoraid}"/>
                </rich:column>
                <rich:column sortBy="#{_tarefapredecessora.id.tarefaid}">
                    <f:facet name="header">Tarefaid</f:facet>
                    <h:outputText value="#{_tarefapredecessora.id.tarefaid}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{tarefaHome.managed}" id="tarefapredecessorasForTarefaid">
        <div class="actionButtons">
            <s:button id="addtarefapredecessora"
                   value="Add tarefapredecessora"
                    view="/TarefapredecessoraEdit.xhtml"
             propagation="none">
                 <f:param name="tarefaId"
                         value="#{tarefaHome.instance.id}"/>
                 <f:param name="tarefapredecessoraFrom" value="Tarefa"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Tarefapredecessoras for tarefapredecessoraid">
        <h:form styleClass="association" id="tarefapredecessorasForTarefapredecessoraidChildren">

            <h:outputText value="There are no tarefapredecessorasForTarefapredecessoraid associated with this tarefa."
                       rendered="#{empty tarefaHome.tarefapredecessorasForTarefapredecessoraid}"/>

            <rich:dataTable value="#{tarefaHome.tarefapredecessorasForTarefapredecessoraid}"
                           var="_tarefapredecessora"
                      rendered="#{not empty tarefaHome.tarefapredecessorasForTarefapredecessoraid}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="tarefapredecessorasForTarefapredecessoraidTable">
                <rich:column sortBy="#{_tarefapredecessora.id.tarefapredecessoraid}">
                    <f:facet name="header">Tarefapredecessoraid</f:facet>
                    <h:outputText value="#{_tarefapredecessora.id.tarefapredecessoraid}"/>
                </rich:column>
                <rich:column sortBy="#{_tarefapredecessora.id.tarefaid}">
                    <f:facet name="header">Tarefaid</f:facet>
                    <h:outputText value="#{_tarefapredecessora.id.tarefaid}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{tarefaHome.managed}" id="tarefapredecessorasForTarefapredecessoraid">
        <div class="actionButtons">
            <s:button id="addtarefapredecessora"
                   value="Add tarefapredecessora"
                    view="/TarefapredecessoraEdit.xhtml"
             propagation="none">
                 <f:param name="tarefaId"
                         value="#{tarefaHome.instance.id}"/>
                 <f:param name="tarefapredecessoraFrom" value="Tarefa"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Subtarefas for tarefaid">
        <h:form styleClass="association" id="subtarefasForTarefaidChildren">

            <h:outputText value="There are no subtarefasForTarefaid associated with this tarefa."
                       rendered="#{empty tarefaHome.subtarefasForTarefaid}"/>

            <rich:dataTable value="#{tarefaHome.subtarefasForTarefaid}"
                           var="_subtarefa"
                      rendered="#{not empty tarefaHome.subtarefasForTarefaid}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="subtarefasForTarefaidTable">
                <rich:column sortBy="#{_subtarefa.id.subtarefaid}">
                    <f:facet name="header">Subtarefaid</f:facet>
                    <h:outputText value="#{_subtarefa.id.subtarefaid}"/>
                </rich:column>
                <rich:column sortBy="#{_subtarefa.id.tarefaid}">
                    <f:facet name="header">Tarefaid</f:facet>
                    <h:outputText value="#{_subtarefa.id.tarefaid}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{tarefaHome.managed}" id="subtarefasForTarefaid">
        <div class="actionButtons">
            <s:button id="addsubtarefa"
                   value="Add subtarefa"
                    view="/SubtarefaEdit.xhtml"
             propagation="none">
                 <f:param name="tarefaId"
                         value="#{tarefaHome.instance.id}"/>
                 <f:param name="subtarefaFrom" value="Tarefa"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>

    <rich:tab label="Utilizacaorecursos">
        <h:form styleClass="association" id="utilizacaorecursosChildren">

            <h:outputText value="There are no utilizacaorecursos associated with this tarefa."
                       rendered="#{empty tarefaHome.utilizacaorecursos}"/>

            <rich:dataTable value="#{tarefaHome.utilizacaorecursos}"
                           var="_utilizacaorecurso"
                      rendered="#{not empty tarefaHome.utilizacaorecursos}"
                    rowClasses="rvgRowOne,rvgRowTwo"
                            id="utilizacaorecursosTable">
                <rich:column sortBy="#{_utilizacaorecurso.id.recursoid}">
                    <f:facet name="header">Recursoid</f:facet>
                    <h:outputText value="#{_utilizacaorecurso.id.recursoid}"/>
                </rich:column>
                <rich:column sortBy="#{_utilizacaorecurso.id.tarefaid}">
                    <f:facet name="header">Tarefaid</f:facet>
                    <h:outputText value="#{_utilizacaorecurso.id.tarefaid}"/>
                </rich:column>
                <rich:column sortBy="#{_utilizacaorecurso.custo}">
                    <f:facet name="header">Custo</f:facet>
                    <h:outputText value="#{_utilizacaorecurso.custo}"/>
                </rich:column>
            </rich:dataTable>

        </h:form>

        <f:subview rendered="#{tarefaHome.managed}" id="utilizacaorecursos">
        <div class="actionButtons">
            <s:button id="addutilizacaorecurso"
                   value="Add utilizacaorecurso"
                    view="/UtilizacaorecursoEdit.xhtml"
             propagation="none">
                 <f:param name="tarefaId"
                         value="#{tarefaHome.instance.id}"/>
                 <f:param name="utilizacaorecursoFrom" value="Tarefa"/>
            </s:button>
        </div>
        </f:subview>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
